# -*- conding:utf-8 -*-

"""
为了统计学生人数，可以给 Student 类增加一个类属性，
每创建一个实例，该属性自动增加：
class Student(object):
    count = 0
    def __init__(self, name):
        self.name = name

"""


class Student(object):
    count = 0

    def __init__(self, name):
        self.name = name
        Student.count += 1
        # 通过类直接调用类属性，创建时自动增加
        print(self.count)


alex = Student('alex')
num = Student('alex')
